<template>
	<view class="content">
		<view class="box">
			<view class="announcement">
				<view class="announcement-item" v-for="item in noticeList">
					<view class="top">
						<view class="title">
							{{item.content}}
						</view>
						<!-- <view class="time">
							
						</view> -->
					</view>
					<view class="bottom">
						<!-- {{item.title}} -->
						{{item.update_time}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				noticeList: [],
				paging: {
					page: 1,
					limit: 10,
				},
				total: null
			}
		},
		onLoad() {
			this.getNoticeList()
		},
		onReachBottom() {
			this.getNoticeList()
		},
		onPullDownRefresh() {
			uni.startPullDownRefresh({
				success: () => this.refresh(),
				complete: () => uni.stopPullDownRefresh()
			})
		},
		methods: {
			getNoticeList(){
				if (this.noticeList.length == this.total) return
				this.$api.noticeList(this.paging).then(res => {
					this.noticeList = [...this.noticeList, ...res.data.list]
					this.total = res.data.total
					this.paging.page++
				})
			},
			// 刷新列表
			refresh() {
				this.paging.page = 1
				this.total = null
				this.noticeList = []
				this.getNoticeList()
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: url('@/static/img/bg.png');
		min-height: 100vh;
		z-index: -1;
	}
	.box {
		padding: 0 30rpx;
		padding-top: 30rpx;
		min-height: 100vh;
		z-index: -1;
	}
	.announcement{
		background: #FFFFFF;
		border-radius: 20rpx;
		min-height: 100vh;
		z-index: -1;
		padding: 0 30rpx;
	}
	.announcement-item{
		padding: 48rpx 0;
		border-bottom: 2rpx solid #e7e7e7;
		.top{
			display: flex;
			justify-content: space-between;
			.title{
				font-family: PingFangSC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #111111;
				line-height: 40rpx;
				text-align: left;
				font-style: normal;
			}
			.time{
				font-family: PingFangSC, PingFang SC;
				font-weight: 600;
				font-size: 28rpx;
				color: #999999;
				line-height: 34rpx;
				text-align: left;
				font-style: normal;
			}
		}
		.bottom{
			padding-top: 20rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			font-size: 28rpx;
			color: #999999;
			line-height: 34rpx;
			text-align: left;
			font-style: normal;
		}
	}
</style>
